package com.jcp.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jcp.entity.Parment;
import com.jcp.entity.Record;
import com.jcp.entity.Users;
import com.jcp.service.PayAlibabaService;
import com.jcp.service.PayService;
import com.jcp.service.phoneService;
import com.jcp.util.LayuiData;

import tk.mybatis.mapper.common.Mapper;

/**
 * 手机端的进出记录控制器
 * @author 朱耿封
 *
 */
@Controller
public class phoneController{
	//依赖注入手机端进出记录的服务层接口对象
	@Autowired
	private  phoneService phone;
	@Autowired
	private PayAlibabaService pabbs;
	
	@GetMapping(value="page1",produces="application/json;charset=utf-8")
	@ResponseBody
	public LayuiData<Record> selectPhoneByPage(HttpServletRequest hsr,@RequestParam(value="page")int page,@RequestParam(value="limit")int limit) {
		Users user1 = (Users)hsr.getSession().getAttribute("user");
		System.out.println("车牌 ： "+user1.getCarNumber());
		LayuiData<Record> ld = phone.selectRecordByPage(page, limit,user1.getCarNumber());
		return ld;
	}
	@GetMapping(value="page2",produces="application/json;charset=utf-8")
	@ResponseBody
	public LayuiData<Parment> selectPhoneByPage1(HttpServletRequest hsr,@RequestParam(value="page")int page,@RequestParam(value="limit")int limit) {
//		Parment parment1=(Parment) hsr.getSession().getAttribute("user");
		Users user1 = (Users)hsr.getSession().getAttribute("user");
//		Users user1 = (Users)hsr.getSession().getAttribute("user");
//		System.out.println("车牌 ： "+user1.getCarNumber());
		
		LayuiData<Parment> ld=pabbs.selectRecordByPage(page, limit,user1.getCarNumber() );
//		LayuiData<Record> ld = phone.selectRecordByPage(page, limit,user1.getCarNumber());
		return ld;
		
	}
}
